package Method;

import Book.BookList;
import java.util.Scanner;

//查找图书
public class FindOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("请输入你要查找的图书：");
        Scanner sc = new Scanner(System.in);
        String name = sc.nextLine();
        int tmp= bookList.getBooksNum();
        for (int i = 0; i < tmp; i++) {
            if (bookList.getBook(i).getName().equals(name) ) {
                System.out.println(bookList.getBook(i));
                return;
            }
        }
        System.out.println("查找失败！");
    }
}
